home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.unix.sco.programmer,comp.lang.c
- Subject: Re: Storing 20 character numbers
- Date: Thu, 04 Apr 96 23:06:37 GMT
- Organization: none
- Message-ID: <828659197snz@genesis.demon.co.uk>
- References: <DpB3sz.J9n@idm.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <DpB3sz.J9n@idm.com> eck@idm.com "Eric Kurbat" writes:
-
- >Hello folks!
- > I've got a question that has probably been asked before, but I need
- >to ask it again... I apologize in advance for any redundancy.
- >
- > Anyway, the question is, how do you store a 20 character integer
- >number in a non-character variable in C without losing any of the digits?
-
- There is no guaranteed way to do this in a basic C variable. Even a system
- that supported 64 bit integers may fall just short of your needs (it can
- represent up to about 1.84E19).
-
- >I did a little bit of playing around and a long double loses precision after
- >about 16 digits. Does anyone have any ideas?
-
- You would have to use some sort of multiple-precision representation. What
- is best would depend on what operations you want to perform on these numbers.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-